package com.qiantu.phone.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import com.hjq.shape.layout.ShapeLinearLayout;
import com.qiantu.phone.R;
import com.qiantu.phone.ui.activity.RoomDeviceActivity;
import com.qiantu.phone.ui.uiutil.LLDeviceUtil;

public class HomeAddDeviceView extends ClickFrameLayout {
    protected ShapeLinearLayout shapeLinearLayout;
    /**
     * 0 默认 1常用 2通用
     */
    private int type;
    private String roomSerialNo;

    public HomeAddDeviceView(Context context) {
        this(context, null);
    }

    public HomeAddDeviceView(Context context, int type, String roomSerialNo) {
        super(context, null);
        this.type = type;
        this.roomSerialNo = roomSerialNo;
        initView();
    }

    public HomeAddDeviceView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    protected int getLayoutId() {
        return R.layout.home_device_add_item;
    }


    protected void initView() {
        View view = LayoutInflater.from(getContext()).inflate(getLayoutId(), this, true);
        shapeLinearLayout = findViewById(R.id.view_device_back);

        view.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                gotoDeviceAddView();
            }
        });
    }

    private void gotoDeviceAddView(){
        ((RoomDeviceActivity)getContext()).showDeviceAddView(roomSerialNo);
    }
}
